package interfaz;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JPanel;

/**
 * Clase que representa un panel con una imagen de fondo.
 * @author Laura Puente
 * @version 1.0
 * @see javax.swing.JPanel
 */
public class JPanelImage extends JPanel {
	
	private static final long serialVersionUID = 1L;
	
	/** Constructora de la clase */
	public JPanelImage() {
		super();
	}
	
	@Override
	public void paintComponent(Graphics g) {
		Graphics2D g2d=(Graphics2D) g;
	    GradientPaint gradient=new GradientPaint(0,(float)g2d.getClipBounds().getHeight()/2,
	    		Color.DARK_GRAY,0,(float)g2d.getClipBounds().getHeight(),Color.BLACK,true);
	    g2d.setPaint(gradient);
	    g2d.fillRect((int)g2d.getClipBounds().getX(), (int)g2d.getClipBounds().getY(),
	    		(int)g2d.getClipBounds().getWidth(), (int)g2d.getClipBounds().getHeight());
	}
}
